package com.longg.controller.dept;

import com.longg.controller.BaseController;
import com.longg.service.IDeptService;
import com.longg.service.impl.DeptServiceImpl;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;
import java.util.Map;
@WebServlet("/dept/*")
public class DeptController extends BaseController {
    private IDeptService deptService = new DeptServiceImpl();

    public void findDeptAndUser(HttpServletRequest req, HttpServletResponse resp){
        HttpSession session = req.getSession();
        List<Map<String, Object>> deptAndUser = deptService.findDeptAndUser();
        session.setAttribute("deptAndUser",deptAndUser);
        try {
            resp.sendRedirect(req.getContextPath() + "/assets/html/department.jsp");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
